package com.jinzecloud.fiction.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jinzecloud.fiction.bean.TbVideo;
import com.jinzecloud.fiction.service.TbVideoService;
import com.jinzecloud.fiction.utils.PageUtils;
import com.jinzecloud.fiction.utils.R;



/**
 * 视频表
 *
 * @author ??
 * @email 1971240051@qq.com
 * @date 2023-10-19 19:38:04
 */
@RestController
@RequestMapping("fiction/tbvideo")
public class TbVideoController {
    @Autowired
    private TbVideoService tbVideoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("fiction:tbvideo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbVideoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{viId}")
    //@RequiresPermissions("fiction:tbvideo:info")
    public R info(@PathVariable("viId") Integer viId){
		TbVideo tbVideo = tbVideoService.getById(viId);

        return R.ok().put("tbVideo", tbVideo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("fiction:tbvideo:save")
    public R save(@RequestBody TbVideo tbVideo){
		tbVideoService.save(tbVideo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("fiction:tbvideo:update")
    public R update(@RequestBody TbVideo tbVideo){
		tbVideoService.updateById(tbVideo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("fiction:tbvideo:delete")
    public R delete(@RequestBody Integer[] viIds){
		tbVideoService.removeByIds(Arrays.asList(viIds));

        return R.ok();
    }

}
